﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using DotNetOpenAuth.AspNet;
using Microsoft.Web.WebPages.OAuth;
using WebMatrix.WebData;
using InMyCity.Filters;
using InMyCity.Models;
using System.Diagnostics;
using System.Data.SqlClient;
using System.Globalization;

namespace InMyCity.Controllers
{
    public class HomeController : Controller
    {
        GettingDataModel GetData = new GettingDataModel();

        public ActionResult Index()
        {
            ViewBag.Message = "What is it about?";

            return View();
        }

        public ActionResult Search()
        {
            ViewBag.Message = "Search an event.";
            string[,] MyData = GetData.GetEvent(User.Identity.Name);
            int Event = GetData.EventNumber(User.Identity.Name); 
            ViewData["MyDataList"] = MyData;
            ViewData["MyEventNumber"] = Event;
            return View();
            
        }

        public ActionResult Create()
        {
            ViewBag.Message = "Create an event.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult CreateEvent(EventModel modelEv, RegisterModel modelLo)
        {
            string MyEventName = modelEv.EventName;
            string MyEventDescription = modelEv.Description;
            GetData.CreatenewEvent(User.Identity.Name, MyEventName, MyEventDescription);
            return RedirectToAction("Index", "Home");
        }

        

        

        
    }
}
